package wechat.rcv.cosuming;

import org.eclipse.xtend.lib.annotations.Accessors
import org.w3c.dom.Document
import wechat.rcv.util.XmlRequestParser

class RequestObj {
//	<xml>
//<ToUserName><![CDATA[toUser]]></ToUserName>
//<FromUserName><![CDATA[FromUser]]></FromUserName>
//<CreateTime>123456789</CreateTime>
//<MsgType><![CDATA[event]]></MsgType>
//<Event><![CDATA[SCAN]]></Event>
//<EventKey><![CDATA[SCENE_VALUE]]></EventKey>
//<Ticket><![CDATA[TICKET]]></Ticket>
//</xml>
	@Accessors String ToUserName
	@Accessors String FromUserName
	@Accessors String CreateTime
	@Accessors String MsgType
	@Accessors String Event
	@Accessors String EventKey
	@Accessors String AgentID
	@Accessors String MsgID
	@Accessors String Status
	
	Document doc;
	new (){}
	new(String xml){
		doc = XmlRequestParser::getDocument(xml)
		if (doc!=null){
			ToUserName = XmlRequestParser::getElementByTagFromDoc(doc, 'ToUserName')
			FromUserName = XmlRequestParser::getElementByTagFromDoc(doc, 'FromUserName')
			CreateTime = XmlRequestParser::getElementByTagFromDoc(doc, 'CreateTime')
			MsgType = XmlRequestParser::getElementByTagFromDoc(doc, 'MsgType')
			Event = XmlRequestParser::getElementByTagFromDoc(doc, 'Event')
			EventKey = XmlRequestParser::getElementByTagFromDoc(doc, 'EventKey')
			AgentID = XmlRequestParser::getElementByTagFromDoc(doc, 'AgentID')
			MsgID = XmlRequestParser::getElementByTagFromDoc(doc, 'MsgID')
			Status = XmlRequestParser::getElementByTagFromDoc(doc, 'Status')
		}
	}
}
